package com.bus;

import java.util.ArrayList;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.drawable.Drawable;
import android.widget.Toast;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.ItemizedOverlay;
import com.google.android.maps.OverlayItem;

public class BusMapOverlay extends ItemizedOverlay<OverlayItem> 
{
        private ArrayList<OverlayItem> mOverlays = new ArrayList<OverlayItem>();
        private Context mContext;
        private StaticRouteInfo staticRouteInfo;
        
        public BusMapOverlay(Drawable defaultMarker, Context context) 
        {
                super(boundCenterBottom(defaultMarker));
                this.mContext = context;
//              for(int i =0;i<staticRouteInfo.route5.length; i++)
//              {
                        addOverlay(new OverlayItem(new GeoPoint(40454410,-86903185), "BUS144W", ""));
//              }
        }

        @Override
        protected OverlayItem createItem(int i) 
        {
                return mOverlays.get(i);
        }

        @Override
        public int size() 
        {
                return mOverlays.size();
        }

        private void addOverlay(OverlayItem overlayItem) 
        {
            mOverlays.add(overlayItem);
            populate();
        }
        

        
    @Override
    protected boolean onTap(int i) 
    {
      Toast.makeText(mContext,
                      mOverlays.get(i).getTitle(),
                      Toast.LENGTH_SHORT).show();
      
      return(true);
    }
    
    protected void updateOverlay()
    {
    }
    
    protected  AlertDialog updateRoutesDialog()
    {
        final CharSequence[] items = {"5", "", "Gold Loop", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""};
        boolean checked[] = null;
        
                AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
                builder.setTitle("Select Routes to display");
                builder.setMultiChoiceItems(items, checked ,new DialogInterface.OnMultiChoiceClickListener()
                {
                        @Override
                        public void onClick(DialogInterface arg0, int arg1, boolean arg2) 
                        {
                                
                        }
                });             
                return builder.create();
    } 
}
